﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GPSManager.aspx.cs" Inherits="GPSTrackingWebsiteManager.Pages.GPSManager" %>

<!DOCTYPE html>

<link href="../../Css/GPSTrackingWebsite.css" rel="stylesheet" />
<link href="../../Css/messi.css" rel="stylesheet" />
<script src="../../Javascript/jquery-1.11.1.min.js"></script>
<script src="../../Javascript/messi.js"></script>
<script src="../../Javascript/Custom.js"></script>
<script src="../../Javascript/WindowMessageManager.js"></script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
        <script type="text/javascript">

            function resizeGrid() {
                var height = window.innerHeight;
                var tableView = $find("<%=GPSGrid.ClientID %>");
                tableView.get_element().style.height = (height) + "px";
                document.getElementById('HiddenFieldHeight').value = (height);

                console.log(window.innerHeight);
                console.log(height);

            }

            //Windows Message Manager 
            var objWindowsMessageManager = new WindowsMessageManager();

        </script>
    </telerik:RadScriptBlock>
</head>
<body onresize="resizeGrid()" style="overflow: hidden">
    <form id="form1" runat="server">
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="GPSGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="GPSGrid" />
                        <telerik:AjaxUpdatedControl ControlID="HiddenFieldError" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
        <asp:HiddenField ID="HiddenFieldHeight" runat="server" Value="323" />
        <asp:HiddenField ID="HiddenFieldError" runat="server" Value="" />
        <div>
                <telerik:RadGrid ID="GPSGrid" runat="server" AutoGenerateColumns="False" AllowSorting="true" CellSpacing="0" GridLines="None" Height="100%" Width="100%" GroupingSettings-CaseSensitive="false" OnNeedDataSource="GPSGrid_NeedDataSource" OnUpdateCommand="GPSGrid_UpdateCommand">
                    <MasterTableView EditMode="PopUp" EditFormSettings-PopUpSettings-Modal="true" EditFormSettings-CaptionFormatString="Modo Edición" CommandItemDisplay="TopAndBottom" NoMasterRecordsText="No hay registros" AllowFilteringByColumn="true" TableLayout="Auto">
                        <CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="Nuevo Grupo" RefreshText="Actualizar"></CommandItemSettings>
                        <CommandItemTemplate>
                            <div style="padding: 5px 5px;">
                                Menu:                              
                                <asp:LinkButton ID="lbClearFilters" runat="server" OnClick="lbClearFilters_Click" Visible='<%# !GPSGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/mixx-icon.png"/>Limpiar Filtros</asp:LinkButton>
                                <asp:LinkButton ID="lbShowError" runat="server" OnClick="lbShowError_Click" Visible='<%# HiddenFieldError.Value == string.Empty ? false : true %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/bug-icon.png"/>Error técnivo</asp:LinkButton>
                            </div>
                        </CommandItemTemplate>
                        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

                        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </RowIndicatorColumn>

                        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </ExpandCollapseColumn>

                        <Columns>
                            <telerik:GridEditCommandColumn ButtonType="ImageButton" EditText="Editar" HeaderStyle-Width="25px" />
                            <telerik:GridBoundColumn DataField="GpsImei" FilterControlAltText="Filter Imei column" HeaderText="Imei" UniqueName="GpsImei" MaxLength="15" ReadOnly="true" ForceExtractValue="Always"
                                 FilterControlWidth="70px" CurrentFilterFunction="EqualTo" ShowFilterIcon="false"  HeaderStyle-Width="100px" AutoPostBackOnFilter="true">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Name column" HeaderText="Nombre" UniqueName="Name" MaxLength="50"
                                 FilterControlWidth="70px" CurrentFilterFunction="EqualTo" ShowFilterIcon="false"  HeaderStyle-Width="100px" AutoPostBackOnFilter="true">
                                <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                    <RequiredFieldValidator ForeColor="Red" ErrorMessage="* Requerido" SetFocusOnError="true"></RequiredFieldValidator>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Description" FilterControlAltText="Filter Description column" HeaderText="Descripción" UniqueName="Description" MaxLength="100"
                                 FilterControlWidth="70px" CurrentFilterFunction="EqualTo" ShowFilterIcon="false"  HeaderStyle-Width="100px" AutoPostBackOnFilter="true">
                                <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                    <RequiredFieldValidator ForeColor="Red" ErrorMessage="* Requerido" SetFocusOnError="true"></RequiredFieldValidator>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                        </Columns>

                        <EditFormSettings>
                            <EditColumn UpdateText="Actualizar" CancelText="Cancelar" ButtonType="ImageButton"></EditColumn>
                        </EditFormSettings>
                    </MasterTableView>
                    <ClientSettings EnableRowHoverStyle="true">
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True"></Scrolling>
                        <Selecting AllowRowSelect="True"></Selecting>
                        <ClientEvents OnPopUpShowing="PopUpShowing" />
                    </ClientSettings>
                    <FilterMenu EnableImageSprites="False"></FilterMenu>
                </telerik:RadGrid>
        </div>
    </form>
</body>
</html>
